<template>
  <a-card size="small" :bordered="false" class="iframe-warp">
    <a-spin size="large" :spinning="spinning">
      <dynamic-link :path="path" :formData="formData"></dynamic-link>
    </a-spin>
  </a-card>
</template>
<script >
import DynamicLink from '@/views/modules/task/form/DynamicLink.vue'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
export default {
  name: 'OnlineIframe',
  data() {
    return {
      spinning: false,
      tableName: '',
      dataId: '',
      path: 'modules/task/form/OnlineFormDetail' // online表单地址
    }
  },
  components: {
    DynamicLink
  },
  computed: {
    formData() {
      return {
        tableName: this.tableName,
        dataId: this.dataId
      }
    }
  },
  mounted() {
    this.tableName = this.$route.query.tableName
    this.dataId = this.$route.query.dataId
    // 本地测试使用
    const token = this.$route.query.token
    if (token) {
      Vue.ls.set(ACCESS_TOKEN, token, 7 * 24 * 60 * 60 * 1000)
    }
  }
}
</script>
<style lang='less'>
// 移动端设置富文本框head隐藏
.iframe-warp fieldset[disabled="disabled"] .tox-editor-header {
  display: none;
}
</style>
